﻿@{
    ViewBag.Title = "Spreadsheet";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<link href="~/css/jquery.treeview.css" rel="stylesheet" />
<script src="~/js/jquery.treeview.min.js"></script>
<script>
    $(document).ready(function () {
        $("#tree").treeview({
            animated: "fast",
            collapsed: true,
        });
    });
</script>
<script src="/js/tabletocsv.js"></script>
<script src="/js/product.js"></script>
<div class="container-fluid">
    <fieldset>
        <legend>Part Editor</legend>
        <form class="margin0" action="/products/searchspreadsheet" id="fr-searchspreadsheet" method="POST">
            <div id="groupfilter" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="groupfilter" aria-hidden="true" data-width="800">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>
                    <h5>Part Group Filter</h5>
                </div>
                <div class="modal-body">
                    <div class="row-fluid">
                        <div class="span5">
                            <div class="border-padding10">
                                <div class="group-filter-tree-bg">
                                    @Html.Raw(ViewBag.Tree)
                                </div>
                            </div>
                        </div>
                        <div class="span2">
                            <div class="row-fluid" style="margin-top: 50px">
                                <input type="button" class="btn btn-success" value="Add -->>" onclick="AddToGroupFilter()" style="width: 100%" />
                            </div>
                            <div class="row-fluid" style="margin: 10px 0">
                                <input type="button" class="btn btn-danger" value="Remove" onclick="removeGroupedFilter()" style="width: 100%" />
                            </div>
                            <div class="row-fluid">
                                <input type="button" class="btn" value="Clear" onclick="$('#groupedFilter').html('');" style="width: 100%" />
                            </div>
                            <div class="row-fluid" style="margin: 152px 0 10px 0">
                                <input type="button" data-dismiss="modal" class="btn btn-primary" value="Ok" style="width: 100%" />
                            </div>
                            <div class="row-fluid">
                                <input type="button" class="btn" value="Cancel" onclick="$('#groupedFilter').html('');" data-dismiss="modal" style="width: 100%" />
                            </div>
                        </div>
                        <div class="span5">
                            <div class="border-padding10">
                                <ul class="group-filter-tree-bg " id="groupedFilter">
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row-fluid">
                <div class="span1">Part Name</div>
                <div class="span7">
                    <input class="input-block-level" type="text" name="partname" />
                </div>
                <div class="span1 text-right">Supplier</div>
                <div class="span3">
                    @Html.DropDownList("CompanyID", null, new { @class = "input-block-level" })
                </div>
            </div>
            <div class="row-fluid">
                <div class="span1">Part Code</div>
                <div class="span7">
                    <input class="input-block-level" type="text" name="partcode" />
                </div>
                <div class="span1 text-right">Store</div>
                <div class="span3">
                    @Html.DropDownList("StoreID", null, new { @class = "input-block-level" })
                </div>
            </div>
            <div class="row-fluid">
                <div class="span1">Part ID</div>
                <div class="span7">
                    <input class="input-block-level" type="text" name="partid" />
                </div>
                <div class="span1 text-right">Stock</div>
                <div class="span3">
                    <select class="input-block-level" name="stock">
                        <option value="all">All</option>
                        <option value="stock controlled">stock controlled</option>
                        <option value="not stock controlled">Not Stock Controlled</option>
                    </select>
                </div>
            </div>
            <div class="row-fluid">
                <div class="span1">Price</div>
                <div class="span2">
                    <select class="input-block-level" name="price">
                        <option></option>
                        <option value="Supplier Trade">Supplier Trade</option>
                        <option value="Our Trade">Our Trade</option>
                        <option value="Carriage">Carriage</option>
                        <option value="Our Trade + Carriage">Our Trade + Carriage</option>
                        <option value="Retail exc VAT">Retail exc VAT</option>
                        <option value="Retail inc VAT">Retail inc VAT</option>
                    </select>
                </div>
                <div class="span2">
                    <select class="input-block-level" name="condition">
                        <option></option>
                        <option value="greater than">greater than</option>
                        <option value="equal to">equal to</option>
                        <option value="less than">less than</option>
                    </select>
                </div>
                <div class="span3">
                    <input class="input-block-level" type="text" name="tbPrice" />
                </div>
                <div class="span2">No of rows</div>
                <div class="span2">
                    <select class="input-block-level" name="rows">
                        <option value="0">All Parts</option>
                        <option value="20">20</option>
                        <option value="50">50</option>
                        <option value="100">100</option>
                        <option value="200" selected="selected">200</option>
                        <option value="500">500</option>
                        <option value="1000">1000</option>
                    </select>
                </div>
            </div>
            <div class="row-fluid">
                <div class="span1"></div>
                <div class="span3">
                    @*<input type="button" class="btn btn-primary" value="Advanced Search" />*@
                    <a href="#groupfilter" role="button" data-toggle="modal" class="btn btn-primary">Group Filter</a>
                </div>
                <div class="span2">
                    <label>
                        <input type="checkbox" class="cbcheck" name="alluncategorized" />
                        All uncategorized</label>
                </div>
                <div class="span4">
                    <label style="float: left; margin-right: 30px">
                        <input type="checkbox" class="cbcheck cbarchived" name="archived" />
                        Archived</label>
                    <label style="float: left; margin-right: 30px">
                        <input type="checkbox" class="cbcheck" name="onsite" />
                        On Site</label>
                    <label>
                        <input type="checkbox" class="cbcheck" name="offsite" />
                        Off Site</label>
                </div>
                <div class="span2 text-right">
                    <input type="reset" class="btn " value="Reset" />
                    <input type="submit" class="btn btn-primary" value="Search" />
                </div>
            </div>
        </form>
    </fieldset>
    <div class="spreadsheet-result">
    </div>
    <div class="associatedproducts-result">
    </div>
    <div class="border-padding10">
        <div class="row-fluid">
            <div class="span10">
                <input type="button" class="btn btn-success" value="Add new part" onclick="PopupCenter('/stockcontrol/editpart',800,650)" />
                <input type="button" class="btn btn-danger part-selected" value="Delete selected" />
                @*<input type="button" class="btn btn-primary" value="Import parts" />*@
                <a href="/img/files/PartUploadNew.xlsx" class="btn btn-primary">Get template</a>
            </div>
            <div class="span2 text-right">
                <input type="button" class="btn btn-primary" value="Export to excel" onclick="ExportCSVWithHead($('.tbspreadsheet'), 'Table.csv', $('.theadspreadsheet'))" />
            </div>
        </div>
    </div>
</div>

